
package at.fhj.ase.clientarch.common.component;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.sql.Timestamp;
import java.util.Properties;

import at.fhj.ase.clientarch.common.TransferObject;
import at.fhj.ase.clientarch.common.exception.BizException;
import at.fhj.ase.clientarch.common.util.CommonUtil;

/**
 * Interface responsible for all hardware related stuff.<br>
 * It also fetches hardware data from the database, e.g. from yesterday until now.
 * 
 * @author cja, sfe | www.fh-joanneum.at | Client Architectures and Design
 */
public interface IHardwareComponent extends Remote {
  public static final String NAME = "HardwareComponent";

  /**
   * Call this method to retrieve the client config as {@link Properties} instance from server.<br>
   * All the config values as keys should be stored in {@link CommonUtil}.<br>
   * This method is intended to be called only once during client lifecycle (application startup).<br>
   * 
   * @return the most current client config (or also the initial config for the client)
   * @throws RemoteException if we had a connection problem
   * @throws BizException if anything else went wrong
   */
  Properties getConfig() throws RemoteException, BizException;

  /**
   * @return a filled {@link TransferObject} if fetching of hardware was successful, otherwise <code>null</code>.
   * @throws RemoteException if we had a connection problem
   * @throws BizException if anything else went wrong
   */
  TransferObject getCurrentData() throws RemoteException, BizException;

  /**
   * @param start the start timestamp where the values are fetched from database
   * @param end the end timestamp where the values are fetched from database
   * @return a filled {@link TransferObject} with values from database (can be in the past)
   * @throws RemoteException if we had a connection problem
   * @throws BizException if anything else went wrong
   */
  TransferObject getDataFromDB(Timestamp start, Timestamp end) throws RemoteException, BizException;
}
